package com.example.myapplicationndk.a;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

import androidx.appcompat.app.AppCompatActivity;

import com.example.myapplicationndk.R;
import com.example.myapplicationndk.databinding.ActivityMainQrcodeBinding;
import com.example.myapplicationndk.h264.MainH264Activity;
import com.example.myapplicationndk.opengl.camerax.CameraActivity;

import okhttp3.OkHttpClient;

public class SplashActivity extends AppCompatActivity {

    OkHttpClient okHttp;

    private Handler handler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 后台返回时可能启动这个页面 http://blog.csdn.net/jianiuqi/article/details/54091181
        if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
            finish();
            return;
        }
        handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                startActivity(new Intent(SplashActivity.this, MainH264Activity.class));
                overridePendingTransition(R.anim.screen_zoom_in, R.anim.screen_zoom_out);
                finish();
            }
        }, 200);
    }

    @Override
    protected void onDestroy() {
        handler = null;
        super.onDestroy();
    }
}